/* ClientApp.java 
* Created on Dec 20, 2012 
* Author:Mr.Viet
* Phone: 01683430426
* Email: phamvanvietcdhd@gmail.com
*/ 
package com.session9; 

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientApp {
	private Socket client;
	private PrintWriter out;
	public ClientApp() {
		
	}

	/**
	 * @param args
	 */

	public void createClient(){
		try {
			this.client = new Socket("localhost",1000);
			//Mo Tai De Lang Nghe Cac Message Tu Server Gui Ve
			ClientTai tai = new ClientTai(client);
			tai.start();
			out = new PrintWriter(this.client.getOutputStream());
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	public void sendMess(String mess){
		out.println(mess);
		out.flush();
	}
	public static void main(String[] args) {
		ClientApp app = new ClientApp();
		app.createClient();
		app.sendMess("Hello Server!");
	}
}
